import { UPDATEPAGEWORKEXP, CLEARPAGEWORKEXP } from '../types/pageworkexp'
import { handleActions } from 'redux-actions'

const Schema = {
  showEmpty: false,
  requestOverFirst: false,
  networkerror: false,
  submitdata: {
    jobtitle: '',
    jobintro: ''
  },
  companyWrap: {
    value: '',
    list: []
  },
  workTimeWrap: {
    value: '',
    fields: 'month',
    mode: 'date'
  },
  workTimeWrapEnd: {
    value: '',
    fields: 'month',
    mode: 'date'
  }
}

export default handleActions(
  {
    [UPDATEPAGEWORKEXP](state, action) {
      return {
        ...state,
        ...action.payload
      }
    },
    [CLEARPAGEWORKEXP](state, action) {
      return {
        ...Schema
      }
    }
  },
  Schema
)
